import java.util.Scanner;
public class Hanoi {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入圆盘的数量");
        int num = in.nextInt();
        hanoi(num, 'A', 'B', 'C');
    }


    public static void hanoi(int num, char a, char b, char c){
        if (num == 1) {
            System.out.println("第" + num + "个圆盘从" + a + " -> " + c);
        }else{
            hanoi(num - 1, a, c, b);
            System.out.println("第" + num + "个圆盘从" + a + " -> " + c);
            hanoi(num - 1, b, a, c);
        }
    }

}
